home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu494.dms / pu494.adf / MANDDEMO / arexx / CalcSequence.mnd2 next >
Text File  |  1993-08-18  |  3KB  |  116 lines

  1. /* This script is supplied with the Mand2000 demo and release */
  2. /* versions and may be freely distributed. */
  3.  
  4. /* An ARexx programming for rendering a series of pictures. */
  5.  
  6. portname = address()    /* Retrieve the current port name. */
  7. /* If the portname does not start with MAND2000 then this script must */
  8. /* have been run with rx, rather than from Mand2000.  Therefore we */
  9. /* need to set the port name.  We do not always set the port name */
  10. /* because it is better to let Mand2000 set it for us, so that */
  11. /* this script can be used with windows other than the one with */
  12. /* port name MAND2000.1. */
  13. if (left(portname, 8) ~= "MAND2000") THEN
  14.     address 'MAND2000.1'
  15.  
  16. options results
  17.  
  18. /* Set up these variables with the number of pictures that you want */
  19. /* calculated and the names of all of the file names.  They will be */
  20. /* loaded in one at a time and saved when they are finished calculating. */
  21. /* This is typically used if you have a series of pictures which will */
  22. /* all take a long time to calculate. */
  23. frames.count = 10
  24. frames.0 = '"ram:frame1"'
  25. frames.1 = '"ram:frame2"'
  26. frames.2 = '"ram:frame3"'
  27. frames.3 = '"ram:frame4"'
  28. frames.4 = '"ram:frame5"'
  29. frames.5 = '"ram:frame6"'
  30. frames.6 = '"ram:frame7"'
  31. frames.7 = '"ram:frame8"'
  32. frames.8 = '"ram:frame9"'
  33. frames.9 = '"ram:frame10"'
  34.  
  35. /* Parse out the command option.  This script is called when the */
  36. /* user wants a sequence started, when the user wants a sequence */
  37. /* finished and whenever one of the pictures in the sequence is done.  */
  38.  
  39. parse arg command
  40.  
  41. if (command = START) then
  42.     StartCalcSequence()
  43. else if (command = STOP) then
  44.     StopCalcSequence()
  45. else
  46.     ContinueCalcSequence(SAVE)
  47.  
  48. Exit
  49.  
  50.  
  51.  
  52. /* Load the first picture and set up everything so that the script */
  53. /* will continue. */
  54.  
  55. StartCalcSequence:
  56.     SETCLIP("Mand2000SequenceNum", 0)
  57.  
  58.     /* Put a command in the user menu for stopping the sequence creation. */
  59.     menu '"------------------------"'
  60.     menu '"Stop Sequence"' calcsequence stop
  61.  
  62.     /* Tell Mand2000 to reinvoke this script whenever a picture */
  63.     /* finishes calculating. */
  64.     EVENTACTION PICTUREDONE calcsequence
  65.     OPEN filename frames.0
  66.     if (RC ~= 0) THEN DO
  67.         StopCalcSequence()
  68.         REQUESTNOTIFY "Couldn't load first file.  This|script must be modified to render|your pictures by putting their|names in the script, or else save|the frames to be rendered as|ram:frame1, ram:frame2, etc."
  69.         EXIT
  70.         END
  71.     GETATTR application stem PROJ
  72.     if (PROJ.DONE = 1) THEN
  73.         ContinueCalcSequence(NOSAVE)
  74.     RETURN 0
  75.  
  76.  
  77.  
  78. StopCalcSequence:
  79.     SETCLIP("Mand2000SequenceNum")
  80.     /* Tell Mand2000 to stop invoking this script whenever a picture */
  81.     /* finishes calculating. */
  82.     EVENTACTION PICTUREDONE
  83.     /* Remove the `Stop Sequence' menu. */
  84.     CLEARNMENUS 2
  85.     RETURN 0
  86.  
  87.  
  88.  
  89. /*
  90.     This portion of the script saves the current picture if necessary
  91. and then loads the next one if there is one.
  92.     */
  93.  
  94. ContinueCalcSequence:
  95.     parse arg savemode
  96.     if (savemode = save) THEN DO
  97.         SAVE
  98.         if (RC ~= 0) THEN DO
  99.             REQUESTNOTIFY "Error in saving file.|Aborting sequence."
  100.             StopCalcSequence()
  101.             EXIT
  102.             END
  103.         END
  104.     SequenceNum = GETCLIP("Mand2000SequenceNum")
  105.     SequenceNum = SequenceNum + 1
  106.     SETCLIP("Mand2000SequenceNum", SequenceNum)
  107.     if (SequenceNum >= frames.count) THEN DO
  108.         StopCalcSequence()
  109.         EXIT
  110.         END
  111.     OPEN filename frames.SequenceNum
  112.     GETATTR application stem PROJ
  113.     if (PROJ.DONE = 1) THEN
  114.         ContinueCalcSequence(NOSAVE)
  115.     RETURN 0
  116.